package binarysearch.test153;

/**
 * @author code_yc
 * @version 1.0
 * @date 2020/7/11 10:42
 */
public class Solution2 {

    // 二分查找
    public int findMin(int[] nums) {
        int l = 0, r = nums.length - 1;
        while (l < r) {
            int mid = l + ((r - l) >> 1);
            if (nums[mid] > nums[r]) {
                l = mid + 1;
            } else {
                r = mid;
            }
        }
        return nums[r];
    }
}
